package com.bwie.controller;

import com.bwie.pojo.TbProd;
import com.bwie.service.TbOrderService;
import com.bwie.utils.R;
import com.bwie.vo.PageOrderVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: Wrj
 * @Date: 2025/4/21 16:25
 * @Description:
 **/
@RestController
@RequestMapping("/order/index")
public class IndexController {

    @Autowired
    TbOrderService tbOrderService;

    @PostMapping("/getOrderById/{id}")
    public R getOrderById(@PathVariable(name = "id") Integer id){
       return tbOrderService.getOrderById(id);

    }

    @PostMapping("/getOrderList")
    public R getOrderList(@RequestBody PageOrderVo pageOrderVo){

        return tbOrderService.getOrderList(pageOrderVo);
    }

    @PostMapping("/addOrder")
    public R addOrder(@RequestBody List<TbProd> tbProdList){

        return tbOrderService.addOrder(tbProdList);

    }

}
